package com.xs.designpattern;

import java.util.Arrays;
import java.util.EnumMap;
import java.util.Map;

/**
 * 为兽人族制造武器的工匠
 * @author xs
 */
public class OrcBlacksmith implements Blacksmith {
    private static final Map<WeaponType, OrcWeapon> ORCARSENAL;

    static {
        ORCARSENAL = new EnumMap<>(WeaponType.class);
        Arrays.stream(WeaponType.values()).forEach(type -> ORCARSENAL.put(type, new OrcWeapon(type)));
    }

    @Override
    public Weapon manufactureWeapon(WeaponType weaponType) {
        return ORCARSENAL.get(weaponType);
    }

    @Override
    public String toString() {
        return "兽人铁匠";
    }
}
